package dev.ece.core.cells.model;

import dev.ece.util.tools.Camera;

/**
 * @author 潜行的青衣
 * @see
 */
public abstract class AbstractUI<T> implements UI<T>, UIEvent<T> {

	private boolean uninitialized = true;
	
	private boolean loaded;
	
	@Override
	public void initialize() {
		if(this.isUninitialized()) {
			this.onInitialize();
			this.setUninitialized(false);
		}
	}

	@Override
	public void render(Camera camera, T value) {
		this.onRender(camera, value);
	}

	protected boolean isUninitialized() {
		return uninitialized;
	}

	protected void setUninitialized(boolean uninitialized) {
		this.uninitialized = uninitialized;
	}

	protected boolean isLoaded() {
		return loaded;
	}

	protected void setLoaded(boolean loaded) {
		this.loaded = loaded;
	}
	
	public abstract float getWidth();
	
	public abstract float getHeight();
	
}
